<?php 
		$user=$session->read('User');
		$colleageid=$session->read("colleageid");
?>
<div class="right_side_operate_area">

	<div class="right_side_title left">
		<h2>
			<?php 
					$colleagename=$session->read("colleagename");
					echo $html->link($colleagename,"/colleages/showcolleageinfo/".$colleageid);
			?>
		</h2>
		<div class="clear"></div>
	</div>
	
    <div class="right item_add_btn">
    <?php 
    	if($form->value('CgPatent.id'))
    	{
    		$str_title=__("Edit",true);
		}
		else
		{
			$str_title=__("Add",true);
		}
		echo $html->link(__("Cancel",true).$str_title,"/colleages/cgpatents/");
    ?>
    </div>
    <div class="clear"></div>
    
</div>

<div class="right_side_scollbar">
    <div class="detail_info_panel">
    
    		<?php echo $form -> create('cgpatents', array('url' => '/colleages/editcgpatent/','enctype'=>'multipart/form-data','type'=> 'post','onsubmit'=>'return checksave()') ); ?>
    		<?php  
    					$statestr = array('模型样机','小试','中试'); 
			        	$radiovalue=array("1"=>"是","0"=>"否");
			         	$attributes=array('legend'=>false);
    		?>
    		
    		
    		<!--专利名称 开始-->
    		<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">专利名称：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPatent.name');?></div>
				       <div id='namemessage' style='display:none;' class="error_message">请填写专利名称</div>
			      </div>
			
			<!--专利名称 结束-->
			
			<!-- 授权时间 开始 -->
			
			<div class="details_item">
			    <div class="form_left_title left">授权时间：</div>
			    <div class="form_right_e_input form_date_picker left">
			    	<?php echo $form->text('CgPatent.authorized_time',array("maxlength"=>"10","style"=>"width:130px","onfocus"=>"WdatePicker()"));?>
			    </div>
			    <div id='timemessage' style='display:none;' class="error_message">请选择授权时间</div>
			</div>
	   		</div>
	  	   <!-- 授权时间 结束 -->
	  	   
	  	  <!--专利图片 开始-->
      	  <div class="details_item_line">
             <div class="details_item">
                <div class="form_left_title left">专利图片：</div>
                <div class="form_right_e_input left">
                <?php 
		                if(!empty($photo))
		                {
			                $photoimg=$photo["file_path"];
			                if($photoimg)
			                {
			                	echo $html->image("/".$photoimg,array("width"=>"200px","height"=>"80px")).'<br/>';
			                	//echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
			                }
		                }
                ?>
                <input type="file" name="PatentPicture[]" />
                </div>
       		</div>
       	
         <!--专利图片 结束-->
	  	   
	  	   <!--拥有者 开始  -->
	  	   
			      <div class="details_item">
				      <div class="form_left_title left">拥有者：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPatent.owner');?></div>
				       <div id='ownermessage' style='display:none;' class="error_message">请填写拥有者</div>
			      </div>
			</div>
			<!--拥有者 结束  -->
			

        
        <!--所属产业 开始-->      
         <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">所属产业：</div>
            	 <div class="form_right_add left">
                	<?php 
				            $industryidlist="";
				            if($pros_cvalues)
				            {
					            foreach($pros_cvalues as $pros_cvalue)
					            {
					            	if(!empty($pros_cvalue["cvid"]))
					            	{
					            		$industryidlist.=$pros_cvalue["cvid"].',';
					            	}
					            }
				            }
		            ?>
		            <div id="pcvalueidlist" class="txthide"><?php echo $industryidlist?></div>
		            
                	<div id="taglist" class="added_item_list left"></div>
                    <div class="add_item_btn left">
	                    <a id="add_drop_float_click" href="javascript:void(0)"><?php __("Add")?></a>
		                <div id="add_float_box" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
					                    $dan="'";
					                    foreach($industrys as $key=>$industry)
					                    {
											echo "<li><label>";
											echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$industry.$dan.','.$dan."#ProjectIndustryname".$dan.','.$dan."#ProjectIndustryid".$dan.','.$dan."#taglist".$dan.')" value="'.$key.'" />'.$industry;
											echo "</label></li>";
											echo "<span id='span".$key."' class='txthide'>".$industry."</span>";
										}
							 ?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.industryname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.industryid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>
        <!--所属产业 结束-->
        
       <!--专利状态 开始-->
	   <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">专利状态：</div>
                <div class="form_right_input left">
                	<?php 
			                	$selectstate = null;
			                	$id=$form->value("CgPatent.id");
			                	if(empty($id)){
			                		$selectstate = $statestr[0];
			                	}
	                			echo $form->select('CgPatent.state',$statestr,$selectstate,null,null);
                	?>
                </div>
            </div>  
        
        <!--专利状态 结束-->
        
        <!--交易时间  开始-->
		
			<div class="details_item">
			    <div class="form_left_title left">交易时间：</div>
			    <div class="form_right_e_input form_date_picker left">
			    	<?php echo $form->text('CgPatent.saled_time',array("maxlength"=>"10","style"=>"width:130px","onfocus"=>"WdatePicker()"));?>
			    </div>
			</div>
	   		</div>
		<!--交易时间  结束-->
        
        <!--状态描述  开始-->
        <div class="details_item_line">
		      <div class="details_item">
			      <div class="form_left_title left">专利状态描述：</div>
			      <div class="form_right_e_input left"><?php echo $form->textarea('CgPatent.state_description',array('class' => 'form_textarea'));?></div>
		      </div>
		
        <!--状态描述 结束  -->
        
        <!--专利介绍 开始-->
        
		      <div class="details_item">
			      <div class="form_left_title left">专利介绍：</div>
			      <div class="form_right_e_input left"><?php echo $form->textarea('CgPatent.describe',array('class' => 'form_textarea'));?></div>
		      </div>
		</div>
		<!--专利介绍 结束-->
		
		<!--优势  开始-->
		<div class="details_item_line">
		      <div class="details_item">
			      <div class="form_left_title left">专利优势：</div>
			      <div class="form_right_e_input left"><?php echo $form->textarea('CgPatent.superiority',array('class' => 'form_textarea'));?></div>
		      </div>
		
		<!--优势  结束-->
		
		<!--应用前景  开始-->
		
		      <div class="details_item">
			      <div class="form_left_title left">应用前景：</div>
			      <div class="form_right_e_input left"><?php echo $form->textarea('CgPatent.apply_prospect',array('class' => 'form_textarea'));?></div>
		      </div>
		</div>
		<!--应用前景  结束-->
		
		<!--使用案例  开始-->
		<div class="details_item_line">
		      <div class="details_item">
			      <div class="form_left_title left">使用案例：</div>
			      <div class="form_right_e_input left"><?php echo $form->textarea('CgPatent.usecase',array('class' => 'form_textarea'));?></div>
		      </div>
		</div>
		<!--使用案例  结束-->
		
        <!--附件块 开始-->
       	<div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">电子材料：</div>
                <div class="form_right_input left">
                	
                	<?php if($attachments){?>
                	<div class="file_category_list">
		        		<div id="filelist0" class="file_lists">
		        			<ul class="file_attach">
			                	<?php
				                	$dan="'";
				                	$second_ownerid=$form->value('Company.second_owner');
				                	$isflag=$action->checkPermissions($user,$id);
				                	foreach($attachments as $attachment) 
				                	{
										echo "<li>";
										echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
										echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
										
										
										echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
										
										echo "</li>";
									}
			                	?>
			                </ul>
		                </div>
		            </div>
		            <?php }?>
		            
                	<div id="add1" class="left text_box"> 
						<div class="file_add_box">
							<input type="file" name="upload[]" />
						</div>
					</div>
					
	        		<div class="clear"></div>
	        		
					<div id="add2" class="left filelist"></div>
					<div class="left clear">
						<div class="left add_sub_file_btn">
							<span onclick="add()" href="#"><?php echo $html->image('list-add.png')?></span>&nbsp;
							<span onclick="remove()" href="#"><?php echo $html->image('list-remove.png')?></span>
						</div>
					</div>
				</div>
					
            </div>
        </div>
        <!--附件块 结束-->
        
        
        
        <!--保存按钮块 开始-->
       	<div class="details_item_line edit_form_btn">
	            <div class="details_item">
		            	<div class="form_left_title left"></div>
		                <div class="form_add_submit left">
			                <?php echo $form->submit(__('Save',true), array("id"=>"addactive","name"=>"submit","class"=>"buttom","div"=>false));  ?>
				            <?php echo $form->hidden('CgPatent.colleage_id',array("value"=>$colleageid)) ;?>
				        	<?php echo $form->hidden('CgPatent.id') ?>
		                </div>
	            </div>
        </div>
        <!--保存按钮块 结束-->
    
    </div>
</div>


<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>
<script type="text/javascript">
var webpath=$("#getpath").attr('href');
function checksave()
{
	var patentname=$("#CgPatentName").val();
	var time = $("#CgPatentAuthorizedTime").val();
	var owner = $("#CgPatentOwner").val();

	if(patentname.trim() == ''){
		$("#namemessage").css('display','block');
		return false;
	}else{
		$("#namemessage").css('display','none');
	}
	if(time.trim() == ''){
		$("#timemessage").css('display','block');
		return false;
	}else{
		$("#timemessage").css('display','none');
	}
	if(owner.trim() == ''){
		$("#ownermessage").css('display','block');
		return false;
	}else{
		$("#ownermessage").css('display','none');
	}
	if(mail.trim() == ''){
		$("#companyemailmessage").css('display','block');
		$("#companyemailmessage").html("请输入联系邮箱");
		return false;
	}else if(!checkEmail(mail.trim())){
		$("#companyemailmessage").css('display','block');
		$("#companyemailmessage").html("联系邮箱格式不正确");
		return false;
	}else{
		$("#companyemailmessage").css('display','none');
	}
	if($("#companyemailmessage").css('display')=="block")
	{
		return false;
	}
	return true;
}


function setuniversty_rely(obj)
{
	var isflag=obj.value;
	if(isflag=="1"){
		$("#deadline").attr("style","display:block");
	}else{
		$("#deadline").attr("style","display:none");
	}
}


function addEV(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
addEV(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("add_drop_float_click"),B=G("add_float_box");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
		if(B!=null){
			B.style.display="block";
		}
	}else if(A!=C){
		if(B!=null){
			B.style.display="none";
		}
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
		}
	}
});

function addEVct(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
</script>